package company.receipt;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class combina {


    public static void p (char[] arrays, int begin, int number, List<Character> list){

        if(number==0){
            System.out.println(list.toString());
            return;
        }
        if(begin==arrays.length){
            return;
        }
        list.add(arrays[begin]);
        p(arrays, begin+1, number-1,list);
        list.remove((Character)arrays[begin]);
        p(arrays, begin+1, number,list);
    }
    private static void getList(List<OrderEntity> orderEntities, int begin, int number, List<OrderEntity> list,List<List<OrderEntity>> result) {

        if (number == 0) {
            System.out.println(list);
            result.add(new ArrayList<>(list));
            return;
        }
        if (begin == orderEntities.size()) {
            return;
        }
        list.add(orderEntities.get(begin));
        getList(orderEntities, begin + 1, number - 1, list, result);
        list.remove(orderEntities.get(begin));
        getList(orderEntities, begin + 1, number, list, result);

    }
    public static void main2(String[] args) {
        char[] arrays={'a','b','c','d','e'};
        List<Character> list= new ArrayList();
        for(int number=1;number<=arrays.length;number++){
            p(arrays,0,number,list);
        }
    }

    public static void main(String[] args) {

        List<OrderEntity> orderEntities = new ArrayList<>();
        for (int i = 0; i <= 19; i++) {
            orderEntities.add(new OrderEntity(Long.valueOf(i), BigDecimal.valueOf(10), BigDecimal.valueOf(33080.48), LocalDateTime.parse("2022-06-18 14:38:30", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))));
        }

        List<OrderEntity> oneCondition = new ArrayList<>();
        List<List<OrderEntity>> result = new ArrayList<>();
        for (int i = 1; i <= orderEntities.size(); i++) {
            getList(orderEntities, 0, i, oneCondition, result);
        }
        System.out.println(true);

    }

    public void getMayMatchOrderList(List<OrderEntity> orderEntities) {
        List<OrderEntity> oneCondition = new ArrayList<>();
        List<List<OrderEntity>> result = new ArrayList<>();
        for (int i = 1; i <= orderEntities.size(); i++) {
            getList(orderEntities, 0, i, oneCondition, result);
        }
    }

    public static void main1(String[] args) {
        HashMap<BigDecimal, String> map = new HashMap<>();
        map.put(BigDecimal.valueOf(1.00).stripTrailingZeros(), "test");
        BigDecimal bigDecimal = BigDecimal.valueOf(1).stripTrailingZeros();
        System.out.println(map.get(bigDecimal));

    }




}
